/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author marcel
 */
public class Contribuinte {
    private String nome;
    private String cpf;
    private String uf;
    private float rendaAnual;

    public Contribuinte(String nome, String cpf,
                        String uf, float rendaAnual){
        this.setNome(nome);
        this.setCpf(cpf);
        this.setUf(uf);
        this.setRendaAnual(rendaAnual);
    }

    public float getImpostoAPagar() {
        return this.rendaAnual * this.getAliquota();
    }

    public float getAliquota() {
        if (this.rendaAnual < 4001)
            return 0;
        if (this.rendaAnual < 9001)
            return 0.058f;
        if (this.rendaAnual < 25001)
            return 0.15f;
        if (this.rendaAnual < 35001)
            return 0.275f;
        return 0.30f;
    }
    /**
     * @return the nome
     */
    public String getNome() {
        return nome;
    }

    /**
     * @param nome the nome to set
     */
    public void setNome(String nome) {
        this.nome = nome;
    }

    /**
     * @return the cpf
     */
    public String getCpf() {
        return cpf;
    }

    /**
     * @param cpf the cpf to set
     */
    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    /**
     * @return the uf
     */
    public String getUf() {
        return uf;
    }

    /**
     * @param uf the uf to set
     */
    public void setUf(String uf) {
        uf = uf.toUpperCase();
        if (uf.equals("RS") ||
            uf.equals("PR") ||
            uf.equals("SC"))
            this.uf = uf;
    }

    /**
     * @return the rendaAnual
     */
    public float getRendaAnual() {
        return rendaAnual;
    }

    /**
     * @param rendaAnual the rendaAnual to set
     */
    public void setRendaAnual(float rendaAnual) {
        if (rendaAnual >= 0)
            this.rendaAnual = rendaAnual;
    }

}
